CachedSynchronizedPairSet
Represents a thread-safe set of key-value pairs with cached keys, values, and pairs for improved performance.
Herda de: SynchronizedPairSet<T, T>
Construtores
public CachedSynchronizedPairSet()
cachedSynchronizedPairSet = CachedSynchronizedPairSet()
Initializes a new instance of the CachedSynchronizedPairSet class.
public CachedSynchronizedPairSet(IEqualityComparer<TKey> comparer)
cachedSynchronizedPairSet = CachedSynchronizedPairSet(comparer)
Initializes a new instance of the CachedSynchronizedPairSet class with the specified key comparer.
- comparer
- The equality comparer to use when comparing keys.
public CachedSynchronizedPairSet(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)
cachedSynchronizedPairSet = CachedSynchronizedPairSet(keyComparer, valueComparer)
Initializes a new instance of the CachedSynchronizedPairSet class with the specified key and value comparers.
- keyComparer
- The equality comparer to use when comparing keys.
- valueComparer
- The equality comparer to use when comparing values.
Propriedades
public TKey[] CachedKeys { get; }
value = cachedSynchronizedPairSet.CachedKeys
Gets an array of cached keys from the set.
public KeyValuePair<TKey, TValue>[] CachedPairs { get; }
value = cachedSynchronizedPairSet.CachedPairs
Gets an array of cached key-value pairs from the set.
public TValue[] CachedValues { get; }
value = cachedSynchronizedPairSet.CachedValues
Gets an array of cached values from the set.
public override TValue Item { set; }
cachedSynchronizedPairSet.Item = value
Gets or sets the value associated with the specified key.
- key
- The key of the value to get or set.
Retorna: The value associated with the specified key.
Métodos
public override void Add(TKey key, TValue value)
cachedSynchronizedPairSet.Add(key, value)
Adds the specified key and value to the set.
- key
- The key of the element to add.
- value
- The value of the element to add.
public override void Clear()
cachedSynchronizedPairSet.Clear()
Removes all keys and values from the set.
protected virtual void OnResetCache(bool isKey)
cachedSynchronizedPairSet.OnResetCache(isKey)
Resets the cached keys, values, and key-value pairs when the set is modified.
- isKey
- Indicates whether the cache reset is due to a key modification.
public override bool Remove(TKey key)
result = cachedSynchronizedPairSet.Remove(key)
Removes the value with the specified key from the set.
- key
- The key of the element to remove.
Retorna: true if the element is successfully found and removed; otherwise, false.